From b976b8510ac2e3c5f10aeb17240b625c087f0a0b Mon Sep 17 00:00:00 2001 From: "kaf24@firebug.cl.cam.ac.uk" Date: Thu, 10 Nov 2005 11:53:51 +0100 Subject: [PATCH] Updates comments in network-bridge, removes dead code, minor typo fixes. Signed-off-by: Nivedita Singhvi --- tools/examples/network-bridge | 38 +++++++++++++++++------------------ 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/tools/examples/network-bridge b/tools/examples/network-bridge index 98a89ff458..4abc5aba77 100755 --- a/tools/examples/network-bridge +++ b/tools/examples/network-bridge @@ -16,7 +16,7 @@ # # Usage: # -# network (start|stop|status) {VAR=VAL}* +# network-bridge (start|stop|status) {VAR=VAL}* # # Vars: # @@ -27,18 +27,27 @@ # netdev The interface to add to the bridge (default eth${vifnum}). # antispoof Whether to use iptables to prevent spoofing (default no). # +# Internal Vars: +# pdev="p${netdev}" +# vdev="veth${vifnum}" +# vif0="vif0.${vifnum}" +# # start: -# Creates the bridge and enslaves netdev to it. -# Copies the IP addresses from netdev to the bridge. -# Deletes the routes to netdev and adds them on bridge. +# Creates the bridge +# Copies the IP and MAC addresses from netdev to vdev +# Renames netdev to be pdev +# Renames vdev to be netdev +# Enslaves pdev, vdev to bridge # # stop: -# Removes netdev from the bridge. -# Deletes the routes to bridge and adds them to netdev. +# Removes netdev from the bridge +# Transfers addresses, routes from netdev to pdev +# Renames netdev to vdev +# Renames pdev to netdev +# Deletes bridge # # status: -# Print ifconfig for netdev and bridge. -# Print routes. +# Print addresses, interfaces, routes # #============================================================================ @@ -97,7 +106,7 @@ s/inet/ip addr add/ s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/[0-9]\+\)@\1@ s/${src}/dev ${dst}/ " | sh -e - # Remove automatic routes on destionation device + # Remove automatic routes on destination device ip route list | sed -ne " /dev ${dst}\( \|$\)/ { s/^/ip route del / @@ -105,17 +114,6 @@ s/${src}/dev ${dst}/ }" | sh -e } -# Usage: del_addrs src -del_addrs () { - local src=$1 - ip addr show dev ${src} | egrep '^ *inet ' | sed -e " -s/inet/ip addr del/ -s@\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\)/[0-9]\+@\1@ -s/${src}/dev ${src}/ -" | sh -e - ip link set dev ${dst} up -} - # Usage: transfer_routes src dst # Get all IP routes to device $src, delete them, and # add the same routes to device $dst. -- 2.30.2